/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/08/18
*/
#ifndef __EDUI_LABEL_H__
#define __EDUI_LABEL_H__

#include "Control.h"

EDUI_NAMESPACE_BEGIN

class EDUI_API Label : public Control
{
protected:
    Label();
    virtual ~Label();
public:
	static Label* GetInterface();
	virtual void Release();
    static Label* ToLabel(Control* ctrl);
public:
    //bWindow:if not font,use window's font
    IFont* GetFont(bool bWindow = true) const;
    bool SetFont(IFont* font);
    virtual void SetText(const char* text);
    virtual const char* GetText() const;

    void SetTranslateText(bool bTranslate);
    bool IsTranslateText();
    const char* GetTranslateText();

    AlignType GetTextAlign();
    void SetTextAlign(AlignType align);

    Rect1 GetTextPadding() const;
    bool  SetTextPadding(const Rect1* padding);

    void SetAutoWidth(bool bauto);
    bool IsAutoWidth() const;
    void SetAutoHeight(bool bauto);
    bool IsAutoHeight() const;

    virtual Size GetFixedSize() const;
    virtual Rect GetFixedRect() const;
protected:
    virtual void RenderText(IRender* render, const Rect* rc);
    
    virtual void SetAttribute(const char* name, const char* value);

    virtual Color* GetDestColor(const char* dstname);
protected:
    Rect GetTextAlignRect(Size* fontSize);
protected:
    String m_text;
    IFont* m_font;
    Color m_textColor;

    bool m_bAutoWidth;
    bool m_bAutoHeight;
    bool m_bTranslateText;

    AlignType m_textAlign;
    Rect1 m_textPadding;
};

EDUI_NAMESPACE_END

#endif